package com.xyz.mockapi.common.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.alibaba.excel.annotation.ExcelProperty;
import com.xyz.mockapi.common.annotation.ExcelValidate; // 导入自定义注解
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;

@Data
@TableName("t_online_product")
@Schema(description = "电驱主线订单-大MES下发订单数据-工单主体信息")
public class OnlineProductEntity implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    @ExcelProperty(value = "序号（id）", index = 0)
    @ExcelValidate(
            fieldName = "序号",        // 前端提示的字段名
            dataType = "Long",        // 数据类型（Long）
            required = true           // 必填
    )
    @Schema(description = "主键ID")
    private Long id;

    @ExcelProperty(value = "队列序号（fId）", index = 1)
    @ExcelValidate(
            fieldName = "队列序号",
            dataType = "Integer",     // 整数类型
            required = true,
            allowValues = {"1", "2", "3"} // 仅允许1、2、3（可按业务调整）
    )
    @Schema(description = "队列序号")
    private Integer fId;

    @ExcelProperty(value = "计划数量（fPlanQuantity）", index = 2)
    @ExcelValidate(
            fieldName = "计划数量",
            dataType = "Integer",
            required = true
    )
    @Schema(description = "计划数量")
    private Integer fPlanQuantity;

    @ExcelProperty(value = "电驱编码（fProductcode）", index = 3)
    @ExcelValidate(
            fieldName = "电驱编码",
            dataType = "String",      // 字符串类型
            required = true
    )
    @Schema(description = "电驱编码")
    private String fProductcode;

    @ExcelProperty(value = "电驱系列（fItemcode）", index = 4)
    @ExcelValidate(
            fieldName = "电驱系列",
            dataType = "String",
            required = true
    )
    @Schema(description = "电驱系列")
    private String fItemcode;

    @ExcelProperty(value = "电驱小机型（fProducttype）", index = 5)
    @ExcelValidate(
            fieldName = "电驱小机型",
            dataType = "String",
            required = true
    )
    @Schema(description = "电驱小机型")
    private String fProducttype;

    @ExcelProperty(value = "工单名称（fProductplanname）", index = 6)
    @ExcelValidate(
            fieldName = "工单名称",
            dataType = "String",
            required = true
    )
    @Schema(description = "工单名称")
    private String fProductplanname;

    @ExcelProperty(value = "队列状态 （fProductstate）0未下发 1已下发 2已上线", index = 7)
    @ExcelValidate(
            fieldName = "队列状态",
            dataType = "Integer",
            required = true,
            allowValues = {"0", "1", "2"} // 仅允许0（未下发）、1（已下发）、2（已上线）
    )
    @Schema(description = "队列状态 0未下发 1已下发 2已上线")
    private Integer fProductstate;

    @ExcelProperty(value = "生产线代码（fLinecode）", index = 8)
    @ExcelValidate(
            fieldName = "生产线代码",
            dataType = "String",
            required = true
    )
    @Schema(description = "生产线代码")
    private String fLinecode;

    @ExcelProperty(value = "fIsfirst（1工单首台 0非工单首台）", index = 9)
    @ExcelValidate(
            fieldName = "工单首台标识",
            dataType = "Integer",
            required = true,
            allowValues = {"0", "1"} // 0=非首台，1=首台
    )
    @Schema(description = "1工单首台 0非工单首台")
    private Integer fIsfirst;

    @ExcelProperty(value = "fIslast（1工单末台 0非工单末台）", index = 10)
    @ExcelValidate(
            fieldName = "工单末台标识",
            dataType = "Integer",
            required = true,
            allowValues = {"0", "1"}
    )
    @Schema(description = "1工单末台 0非工单末台")
    private Integer fIslast;

    @ExcelProperty(value = "fPackage（1打包 0不打包）", index = 11)
    @ExcelValidate(
            fieldName = "打包标识",
            dataType = "Integer",
            required = true,
            allowValues = {"0", "1"}
    )
    @Schema(description = "1打包 0不打包")
    private Integer fPackage;

    @ExcelProperty(value = "fWhiteBoard（白板机 0非白板机）", index = 12)
    @ExcelValidate(
            fieldName = "白板机标识",
            dataType = "Integer",
            required = true,
            allowValues = {"0", "1"}
    )
    @Schema(description = "白板机 0非白板机")
    private Integer fWhiteBoard;

    @ExcelProperty(value = "fClone（克隆机 0非克隆机）", index = 13)
    @ExcelValidate(
            fieldName = "克隆机标识",
            dataType = "Integer",
            required = true,
            allowValues = {"0", "1"}
    )
    @Schema(description = "克隆机 0非克隆机")
    private Integer fClone;
}